//
//  BusinessTableViewCell.m
//  beautyLamp
//
//  Created by Tam Kwok To Michael on 2017/8/18.
//  Copyright © 2017年 Tam Kwok To Michael. All rights reserved.
//

#import "BusinessTableViewCell.h"
#import "Partner.h"
#import "BLHeader.h"
#import <SDWebImage/UIImageView+WebCache.h>

@interface BusinessTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@end

@implementation BusinessTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.iconImageView.layer.cornerRadius = 22;
    self.iconImageView.layer.masksToBounds = YES;
}

- (void)setupCell:(Partner *)partner indexPath:(NSIndexPath *)indexPath {
    
    if(indexPath.section ==0) {
        NSString *userClass = [[NSUserDefaults standardUserDefaults] objectForKey:USERCLASS];
        self.nameLabel.text = [userClass integerValue] == 1 ? @"添加销售" : @"添加店主";
        return;
    }
    self.nameLabel.text = partner.name;
   // [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:partner.headImg]];
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:partner.headImg] placeholderImage:[UIImage imageNamed:@"icon"]];
}



- (void)setupCell:(Partner *)partner {
    self.nameLabel.text = partner.name;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:partner.headImg] placeholderImage:[UIImage imageNamed:@"icon"]];
}
@end
